from django.db import models
from django.contrib.auth.models import User
from musicmanager.models import Music

# Create your models here.
class Action(models.Model):
    user = models.ForeignKey(User)
    music = models.ForeignKey(Music)
    action = models.TextField()
    date = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        l = len(self.action)
        if l > 20:
            l = 20
        return self.action[0:l]

class MusicError(models.Model):
    promoteuser = models.IntegerField()
    solveuser = models.ForeignKey(User)
    desp = models.TextField()
    solved = models.BooleanField()
    date = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        l = len(self.desp)
        if l > 20:
            l = 20
        return self.desp[0:l]
"""    
class MusicError2(models.Model):
    promoteuser = models.ForeignKey(User)
    solveuser = models.ForeignKey(User)
    desp = models.TextField()
    solved = models.BooleanField()
    date = models.DateTimeField(auto_now=True)
"""
